package com.wfh.yudada.mapper;

import com.wfh.yudada.model.entity.UserAnswer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author lenovo
* @description 针对表【user_answer(用户答题记录)】的数据库操作Mapper
* @createDate 2025-05-21 16:16:29
* @Entity com.wfh.yudada.model.entity.UserAnswer
*/
public interface UserAnswerMapper extends BaseMapper<UserAnswer> {

    // 获取某应用答题的所有用户 id
    @Select("select distinct(userId) from user_answer where appId = #{appId}")
    List<Long> getUserIdListByAppId(Long appId);

    // 删除某应用所有的回答
    @Delete("delete from user_answer where appId = #{appId}")
    int deleteByAppId(Long appId);
}




